Tryit Editor v2.3

Edit This Code:
<!DOCTYPE html> <html> <body> <p id="demo"></p> <script> function person(first, last, age, eye) { this.firstName = first; this.lastName = last; this.age = age; this.eyeColor = eye; } var myFather = new person("John", "Doe", 50, "blue"); var myMother = new person("Sally", "Rally", 48, "green"); document.getElementById("demo").innerHTML = "My father is " + myFather.age + ". My mother is " + myMother.age; </script> </body> <!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_object_constructor by HTTrack Website Copier/3.x [XR&CO'2014], Fri, 23 Jan 2015 07:24:36 GMT --> </html>
Result:
Try it Yourself - © w3schools.com